import Mock from 'mockjs';
import setupMock from '@/utils/setupMock';


const data = {
    "createTime": 1598256096,
    "updateTime": 1619316747,
    "_id": "5f4373e094c942f8bc6daa6a",
    "header": {
        "openSearch": true,
        "login": true,
        "register": true,
        "_id": "5f4373e094c942f8bc6daa6b",
        "logo": "",
        "title": "NeverGiveUpT"
    },
    "footer": {
        "_id": "5f4373e094c942f8bc6daa72",
        "copyright": "Copyright © 2020 NeverGiveUpT・蜀ICP备2020026338号",
        "extra": "本系统由Vue+Muse-UI提供技术支持"
    }
}


setupMock({
    setup: () => {
        Mock.mock(new RegExp('/api/site/hf'), 'get', () => {
            return {
                msg: "查询成功",
                code: 200,
                data
            }
        });

        Mock.mock(new RegExp('/api/site/hf'), 'post', (params) => {
            console.log('---', params);
            const data = JSON.parse(params.body);
            return {
                msg: "保存成功",
                code: 200,
                data
            }
        });

        Mock.mock(new RegExp('/api/site/hf'), 'put', (params) => {
            const data = JSON.parse(params.body);
            console.log('---', params);
            return {
                msg: "修改成功",
                code: 200,
                data
            }
        });
    },
});
